#!/usr/bin/env coffee

import {mkdirSync} from 'fs'
import {HOME} from '../const/dir'
import {decode as utf8Decode, encode as utf8Encode} from '@rmw/utf8'
import {join,normalize as _normalize} from 'path'

export ROOT = join HOME, 'mnt'
ROOT_LEN = ROOT.length+1

mkdirSync(ROOT, { recursive: true })

export normalize = (fp)=>
  join(ROOT, _normalize utf8Decode fp)

export realpath = (fp)=>
  join(ROOT, utf8Decode fp)

export relpath = (path)=>
  utf8Encode path[ROOT_LEN..]
